package AStar;

import nav.Crossing;

public class AStarNodeImpl implements AStarNode{

	private Crossing crossing;
	private AStarNode successorNode;
	
	private double costsFromNodeToGoal; // h
	private double costsFromStartToNode; // g
	private double costsFromStartToGoal; // f
	
	public AStarNodeImpl(Crossing crossing) {
		this.crossing = crossing;
		this.successorNode = null;
		this.costsFromNodeToGoal = 0;
		this.costsFromStartToGoal = 0;
		this.costsFromStartToNode = 0;
	}

	@Override
	public Crossing getCrossing() {
		return crossing;
	}

	@Override
	public AStarNode getSuccessorNode() {
		return successorNode;
	}

	@Override
	public void setSuccessor(AStarNode node) {
		this.successorNode = node;
	}
	
	@Override
	public double getCostsFromNodeToGoal(){
		return costsFromNodeToGoal;
	}
	
	@Override
	public void setCostsFromNodeToGoal(double costsFromNodeToGoal){
		this.costsFromNodeToGoal = costsFromNodeToGoal; 
	}
	
	@Override
	public double getCostsFromStartToNode(){
		return costsFromStartToNode;
	}
	
	@Override
	public void setCostsFromStartToNode(double costsFromStartToNode){
		this.costsFromStartToNode = costsFromStartToNode;
	}
	
	@Override
	public double getCostsFromStartToGoal(){
		return costsFromStartToGoal;
	}
	
	@Override
	public void setCostsFromStartToGoal(double costsFromStartToGoal){
		this.costsFromStartToGoal = costsFromStartToGoal;
	}

	@Override
	public boolean equals(AStarNode node){
		if(this.successorNode == node.getSuccessorNode() &&
				this.crossing == node.getCrossing()){
			return true;
		}
		return false;
	}
}
